app.controller('OrderDetailCtrl', function ($scope, $stateParams, OrderService, ConfigMap,RecordService) {
    $scope.order = OrderService.get($stateParams.orderId);
    $scope.imageUrls = $scope.order.imageUrls.split(',');
    // $scope.photoPreUrl = ConfigMap.serverImagePreUrl;
   	$scope.isPlayIng = false; 
    var radioMedia = null;

    $scope.playRecord = function(){
        console.log($scope.order.radioUrl);
    	radioMedia = new Media($scope.order.radioUrl);
    	if(radioMedia){
    		radioMedia.play();
            $scope.isPlayIng = true;
            RecordService.countdown(function(){
                $scope.isPlayIng = false;
            });
    	}
    };

    $scope.stopRecord = function(){
    	if(radioMedia){
            $scope.isPlayIng = false;
    		radioMedia.pause();
    		radioMedia.release();
    	}
    };
});